﻿using System;
using System.Collections.Generic;
using System.Xml.Serialization;

namespace LdtJudge.DataEngine.Model.Personnel
{
    /// <summary>
    /// 人员提取正则配置类
    /// </summary>
    [Serializable]
    [XmlRootAttribute("root", IsNullable = false)]
    public class PersonExtRegConfig
    {
        /// <summary>
        /// 编码
        /// </summary>
        [XmlAttribute("code")]
        public string Code { get; set; }
        /// <summary>
        /// 配置名称
        /// </summary>
        [XmlAttribute("name")]
        public string Name { get; set; }

        /// <summary>
        /// 配置规则组
        /// </summary>
        [XmlElementAttribute("originaltext", IsNullable = false)]
        public List<OriginalText> OriginalTexts { get; set; }
    }

    /// <summary>
    /// 原文设置
    /// </summary>
    public class OriginalText
    {
        /// <summary>
        /// 编码
        /// </summary>
        [XmlAttribute("code")]
        public string Code { get; set; }

        /// <summary>
        /// 表配置
        /// </summary>
        [XmlElementAttribute("row", IsNullable = false)]
        public List<TableConfig> TableConfigs { get; set; }
    }

    /// <summary>
    /// 表设置
    /// </summary>
    public class TableConfig
    {
        /// <summary>
        /// 编号
        /// </summary>
        [XmlAttribute("code")]
        public string Code { get; set; }

        /// <summary>
        /// 表名
        /// </summary>
        [XmlAttribute("talbename")]
        public string TableName { get; set; }

        /// <summary>
        /// 表主键名称
        /// </summary>
        [XmlAttribute("pk")]
        public string PK { get; set; }

        /// <summary>
        /// 列集合
        /// </summary>
        [XmlElementAttribute("fielddata", IsNullable = false)]
        public List<FiledData> FiledDatas { get; set; }

        /// <summary>
        /// 子表
        /// </summary>
        [XmlElementAttribute("row", IsNullable = false)]
        public List<TableConfig> ChildTable { get; set; }
    }

    /// <summary>
    /// 字段列集合
    /// </summary>
    public class FiledData
    {
        /// <summary>
        /// 编码
        /// </summary>
        [XmlAttribute("code")]
        public string Code { get; set; }
        /// <summary>
        /// 列名
        /// </summary>
        [XmlAttribute("columnname")]
        public string ColumnName { get; set; }
    }
}
